package com.hxk;

import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * info级别日志处理类-消费者
 * @author Cactus
 */
@Component//将对象交由spring ioc管理
//开启rabbitmq监听器
@RabbitListener(
		//绑定队列
		bindings=@QueueBinding(
					//配置交换器@Exchange value:为交换器起个名称 @Exchange type:指定具体的交换器类型
					exchange=@Exchange(value="${mq.config.exchange}",type=ExchangeTypes.DIRECT),
					//info 路由键
					key="${mq.config.queue.info.routing.key}",
					//绑定队列的名称@Queue value:配置队列名称 @Queue autoDelete:是否是一个可删除的临时队列
					value=@Queue(value="${mq.config.queue.info}", autoDelete="true")
				)
		)
public class InfoConsumer {
	
	@RabbitHandler//标注该方法是消息处理方法
	public void process(String msg) {
		System.out.println("info..........msg...."+msg);
	}
}
